package org.cupk2.base.jwt;

import org.cupk2.tools.config.Cupk2ConfigEnum;
import org.cupk2.tools.config.Cupk2ConfigUtils;

public class CupkJwtConfig {


    public static String expiresMinute = new Cupk2ConfigUtils(Cupk2ConfigEnum.CUPK2_PROPERTIES).getData("cupk2.conf.jwt.auth.expires.minute");
    public static String expiresHours = new Cupk2ConfigUtils(Cupk2ConfigEnum.CUPK2_PROPERTIES).getData("cupk2.conf.jwt.refresh.expires.hours");

    public enum ClaimsKey {
        LoginName("loginname"),

        LoginId("loginid"),

        IP("ip"),

        TYPE("type");

        private String key;

        ClaimsKey(String key) {
            this.key = key;
        }

        public String getKey() {
            return key;
        }
    }

    public static long getRefreshTtlMillis() {
        return (60 * 1000) * 60 * Integer.valueOf(expiresHours);
    }


    public static long getAuthTtlMillis() {
        return (60 * 1000) * Integer.valueOf(expiresMinute);
    }
}
